package com.iodemo;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class ReadPropertiesTest {
    public static void main(String[] args) {
        InputStream is = null;
        InputStreamReader isr = null;
        BufferedReader br = null;
        Map<String,String> map = new HashMap<>();

        try {
            is = ReadPropertiesTest.class.getClassLoader().getResourceAsStream("info.properties");
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);
            String str;
            while ((str = br.readLine()) != null) {
                String[] split = str.split("=");
                map.put(split[0],split[1]);
            }
            System.out.println(map);


        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(br);
            IOUtils.closeQuietly(isr);
            IOUtils.closeQuietly(is);
        }
    }
}
